﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Utility;
using Entity;
using DataAccess.IService;
using DataAccess.Service;
using System.Data;

namespace Business.Manager
{
    public class AnnouncementManagerImp
    {
        AnnouncementService announcementService = new AnnouncementService();
        public bool generateAnnouncement(Announcement announce)
        {
            return announcementService.insertAnnoucement(announce);
        }
        public DataSet getAnnouncements()
        {
            return announcementService.selectAnnouncementDataSet();
        }
        public Announcement getAnnouncement(int id)
        {
            return announcementService.selectAnnouncement(id);
        }

        public bool updateAnnouncement(Announcement announcement, int id)
        {
            return announcementService.updateAnnouncement(announcement,id);
        }

        public bool delAnnouncements(int id)
        {
            return announcementService.deleteAnnouncement(id);
        }

        public DataSet selectArcticle(string key, string value)
        {
            if (value.Equals("标题"))
            {
                return announcementService.selectActicleByTitlte(key);
            }
            else if(value.Equals("作者")){
                return announcementService.selectActicleByAnthour(key);

            }
            else {
                return announcementService.selectArticleByReadTime(key);
            }
        }
    }

}
